package com.itheima.job;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test03 {
    public static void main(String[] args) {
        ExecutorService pool = Executors.newFixedThreadPool(2);
        pool.submit(new MyRunnable());
        pool.submit(new MyRunnable());

        pool.shutdown();
    }
}

class MyRunnable implements Runnable{

    @Override
    public void run() {
        System.out.println("我需要一个老师");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("老师："+Thread.currentThread().getName());
        System.out.println("教我java,教完后，老师回到了办公室");
    }
}
